﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ProDeletorGUI
{
    [DefaultPropertyAttribute("Name")]

    class TaskSettings
    {
        private string name;
        private bool recursive;
        private string folder;
        private string fileMask;
        private bool emptyFolders;
        private bool testMode;
        private bool logging;
        private string logpath;
        private bool monday;
        private bool tuesday;
        private bool wednesday;
        private bool thursday;
        private bool friday;
        private bool saturday;
        private bool sunday;
        private int hour;
        private int minute;
        private int keepDays;
        private int keepHours;
        private int keepMinutes;
        private bool archive;
        private string archiveFolder;
        private string mode;
        private string triggerMode;

        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Friendly Name of task.")]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Full path to folder, use UNC for network folders.")]
        public string Folder
        {
            get { return folder; }
            set { folder = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Searchpattern of included files, use comma to separate. Example \"*.txt,*.bmp\"")]
        public string FileMask
        {
            get { return fileMask; }
            set { fileMask = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Traverse subfolders.")]
        public bool Recursive
        {
            get { return recursive; }
            set { recursive = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Delete empty subfolders.")]
        public bool DeleteEmptyFolders
        {
            get { return emptyFolders; }
            set { emptyFolders = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Set true to archive files before delete.")]
        public bool Archive
        {
            get { return archive; }
            set { archive = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Full path of archive folder.")]
        public string ArchiveFolder
        {
            get { return archiveFolder; }
            set { archiveFolder = value; }
        }

        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Write all actions to logfile.")]
        public bool Logging
        {
            get { return logging; }
            set { logging = value; }
        }
        [CategoryAttribute("Base Settings")]
        [DescriptionAttribute("Full path and filename of logfile.")]
        public string LogPath
        {
            get { return logpath; }
            set { logpath = value; }
        }
        [TypeConverter(typeof(ModeConverter)),
        CategoryAttribute("Keeptime")]
        [DescriptionAttribute("Compare keeptime to, last accessed, last modified or created.")]
        //[DefaultValueAttribute("Last accessed")]
        public string Mode
        {
            get { return mode; }
            set { mode = value; }
        }
        [CategoryAttribute("Keeptime")]
        [DescriptionAttribute("Time to keep files in days. Value can be 0-365.")]
        public int KeepDays
        {
            get { return keepDays; }
            set
            {
                if (value < 0)
                    value = 0;
                else if (value > 365)
                    value = 365;
                keepDays = value;
            }
        }
        [CategoryAttribute("Keeptime")]
        [DescriptionAttribute("Time to keep files in hours. Value can be 0-23.")]
        public int KeepHour
        {
            get { return keepHours; }
            set
            {
                if (value < 0)
                    value = 0;
                else if (value > 23)
                    value = 23;
                keepHours = value;
            }
        }
        [CategoryAttribute("Keeptime")]
        [DescriptionAttribute("Time to keep files in minutes. Value can be 0-59.")]
        public int KeepMinutes
        {
            get { return keepMinutes; }
            set
            {
                if (value < 0)
                    value = 0;
                else if (value > 59)
                    value = 59;
                keepMinutes = value;
            }
        }
        [TypeConverter(typeof(TriggerConverter)),
        CategoryAttribute("Triggertime")]
        [DescriptionAttribute("Start time of task, once in a day or repeat every hh:mm starting from 00:00.")]
        //[DefaultValueAttribute("Daily")]
        public string TriggerMode
        {
            get { return triggerMode; }
            set { triggerMode = value; }
        }
        [CategoryAttribute("Triggertime")]
        [DescriptionAttribute("Start or repeat time in hours. Value can be 0-23.")]
        public int Hour
        {
            get { return hour; }
            set
            {
                if (value < 0)
                    value = 0;
                else if (value > 23)
                    value = 23;
                hour = value;
            }
        }
        [CategoryAttribute("Triggertime")]
        [DescriptionAttribute("Start or repeat time in minutes. Value can be 0-59.")]
        public int Minute
        {
            get { return minute; }
            set
            {
                if (value < 0)
                    value = 0;
                else if (value > 59)
                    value = 59;
                minute = value;
            }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every monday.")]
        public bool Monday
        {
            get { return monday; }
            set { monday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every tuesday.")]
        public bool Tuesday
        {
            get { return tuesday; }
            set { tuesday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every wednesday.")]
        public bool Wednesday
        {
            get { return wednesday; }
            set { wednesday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every thursday.")]
        public bool Thursday
        {
            get { return thursday; }
            set { thursday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every friday.")]
        public bool Friday
        {
            get { return friday; }
            set { friday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every saturday.")]
        public bool Saturday
        {
            get { return saturday; }
            set { saturday = value; }
        }
        [CategoryAttribute("Weekdays")]
        [DescriptionAttribute("Task run every sunday.")]
        public bool Sunday
        {
            get { return sunday; }
            set { sunday = value; }
        }
        [CategoryAttribute("Testing")]
        [DescriptionAttribute("Only test every files and write to logfile, do nothing actions.")]
        public bool TestMode
        {
            get { return testMode; }
            set { testMode = value; }
        }

    }
}
